using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.ResourceManagement.AsyncOperations;

public class TestLoadByName : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        AsyncOperationHandle<GameObject> test =
            Addressables.InstantiateAsync("Assets/ExampleAssets/Prefabs/Workbench.prefab");
        test.Completed += OnAssetLoaded;
        Addressables.Release(test);
        Debug.Log("test22222222222222222222");
        // test.Completed -= OnAssetLoaded;
        Resources.UnloadUnusedAssets();
    }

    // Update is called once per frame
    void Update()
    {
        
    }

    void OnAssetLoaded(AsyncOperationHandle<GameObject> handle)
    {
        // Addressables.Release(handle);
        Debug.Log("test111111111111111111");
        // Resources.UnloadUnusedAssets();
    }
}
